/**
 * Created by wangshaohua on 2018/1/13.
 */
moduleOrganizationClient.controller("OrganizationClientQuery", function (EmsMgtOrganizationClientResource, LanguageService, $scope, $log, $state, GeneralResource, LoadingService, ConstantService, DialogService) {
    initPage($scope);
    $scope.$on("$viewContentLoaded", function () {
        // $scope.reset();
        pageOnLoad($scope);
        ConstantService.addState($state.current, true, LanguageService.language('企业账号管理'));
        $scope.query(1);
    });

    $scope.reset = function () {

    }

    $scope.query = function (pageNo) {
        EmsMgtOrganizationClientResource.query({pageNo: pageNo - 1, pageSize: 10}, {key: $scope.key}, function (queryResult) {
            $log.debug("查询结果", queryResult.data);
            $scope.queryResult = queryResult.data;
            $scope.pagination.setPage(queryResult.data, pageNo);
        });
    };
    $scope.pagination = new Pagination();
    $scope.pagination.setPageClickFn($scope.query);

    $scope.openDetail = function (record) {
        $state.go("sz.organizationClientDetail", {
            organizationClientId: record.id,
            organizationClientCode: record.code
        });
    }

    $scope.treeDetail = function (record) {
        $state.go("sz.organizationClientTreeDetail", {
            organizationClientId: record.id
        });
    }
});